<?php
namespace Home\Controller;
use Think\Controller;
    class LoginController extends Controller{
        public function index(){
            $this->display();
        }
        public function dologin(){
            $data['name']=htmlspecialchars(I("post.name"));
            $data['pwd']=md5(I("post.pwd"));
            $model=M('user');
            $res=$model->where($data)->find();
            if(empty($res)){
                echo 0;
            }else{
                session('name',$data['name']);
                echo 1;
            }
        }
        public function outlogin(){
            session('name',null);
            $this->redirect('Login/index');
        }
    }